/*
*TABLE 2
Moderation of Association between Firm-Level Exposure to PSL Mandates and Workers' reports of Access to PSL in States and Counties without PSL mandates by Firm Headquarters Location
*/

cd "$exhibits_path"

use "$data_path/main_analysis_file.dta", clear

*Setting global macros for controls
	global demog i.gender i.race2_harm c.age_text_clean i.kids i.eslhome i.enrolled i.cohabstatus
	global work i.manager i.longwork_yrs i.union c.hourwage_clean c.usualhours_clean 
	global statechars c.unionmem_pc c.unemp_rate  c.minwage_state  	c.race_black c.race_amind c.race_asian c.race_pacisl c.race_multi c.race_other c.hispan c.age_u5 c.age_5to9 c.age_10to14 c.age_75to84 c.age_85plus c.female_pc c.educ_pc_hsgrad c.educ_pc_somecoll c.educ_pc_assoc c.educ_pc_bach c.educ_pc_grad
	global empchars i.shift_ind c.total_emps c.total_ests


*Regressions interacting reported access to paid sick leave (percent of workers) with firm headquartered in a PSL mandated place 
eststo col2row7_9: mi est, post: reg benefits_paidsick c.pct_emps_psl_place##i.HQ_PSL_Covered $demog $work $statechars $empchars i.statelist i.year##i.month if  psl_law_places_hybd == 0, vce(cluster statelist)

*Regressions interacting reported access to paid sick leave (percent of establishments) with firm headquartered in a PSL mandated place 
eststo col2row10_12: mi est, post: reg benefits_paidsick c.pct_ests_psl_place##i.HQ_PSL_Covered $demog $work $statechars $empchars i.statelist i.year##i.month if  psl_law_places_hybd == 0, vce(cluster statelist)

label var pct_emps_psl_place "Percent of Workers"


esttab col2row7_9   using "$exhibits_path/Table 2.tex", ///
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \begin{tabular}{l*{1}{c}} \hline\hline") ///
	fragment keep(pct_emps_psl_place 1.HQ_PSL_Covered 1.HQ_PSL_Covered#c.pct_emps_psl_place) /// 
	coeflabel(pct_emps_psl_place "\hspace{0.5cm} Percent of Workers" 1.HQ_PSL_Covered "\hspace{0.5cm} Firm Headquartered in PSL Mandated Place" 1.HQ_PSL_Covered#c.pct_emps_psl_place "\hspace{0.5cm} Percent of Workers Covered by PSL $\times$ HQ Covered") ///
	 eqlabels(none) noomitted noconstant nonumbers nonote noobs not nodepvars  label b(%9.3f) ///
	 refcat(pct_emps_psl_place "\emph{Share in PSL Covered State or County}", nolabel) ///
	 star(+ 0.10 * 0.05 ** 0.01 *** 0.001) ///
	 mtitle("PSL Access in Non-Mandate Places") ///
	replace 

esttab  col2row10_12  using "$exhibits_path/Table 2.tex", ///
	fragment keep(pct_ests_psl_place 1.HQ_PSL_Covered 1.HQ_PSL_Covered#c.pct_ests_psl_place) ///
		coeflabel(pct_ests_psl_place "\hspace{0.5cm} Percent of Establishments" 1.HQ_PSL_Covered "\hspace{0.5cm} Firm Headquartered in PSL Mandated Place" 1.HQ_PSL_Covered#c.pct_ests_psl_place "\hspace{0.5cm} Percent of Establishments Covered by PSL $\times$ HQ Covered") ///
		refcat(pct_ests_psl_place "\\ \emph{Share in PSL Covered State or County}", nolabel) ///
	postfoot("\hline\hline \multicolumn{2}{l}{\footnotesize \sym{+} \(p<0.10\), \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\ \end{tabular} } ") ///
	nomtitles eqlabels(none) noomitted noconstant not nonote  nodepvars nonumbers nolines label b(%9.3f) /// 
	sfmt(%9.0f) ///
	prefoot("\vspace{0.1em} \\") ///
	star(+ 0.10 * 0.05 ** 0.01 *** 0.001) ///
	append